package processcontrol;

import java.util.Scanner;

/**
 * @author shkstart
 * @date 2022/4/7 - 21:30
 */

/*         获取一个随机产生一个两位数 [10,99]
* 公式： [a,b] : (int)(Math.random()* (b - a + 1) + a)
*                (int)(Math.random()* (b - a + 1) )+ a
*                都可以*/
public class IfTest04 {
    public static void main(String[] args) {
//        1.随机产生一个两位数
//        System.out.println(Math.random());//产生[0,1);
        int number = (int)(Math.random()* 90 + 10);//得到[10,99]，即[10,100]
//        System.out.println(number);


        int numberShi = number / 10;
        int numberGe = number % 10;

//        2.用户输入一个两位数
        Scanner input = new Scanner(System.in);
        System.out.println("请输入一个两位数");
        int guess = input.nextInt();

        int guessShi = guess / 10;
        int guessGe = guess % 10;

        if (number == guess) {
            System.out.println("奖励10000");
        }else if (numberShi == guessGe && numberGe == guessShi) {
            System.out.println("奖励5000");
        }else if (numberShi == guessShi || numberGe == guessGe) {
            System.out.println("奖励1000");
        }else if (numberShi == guessGe || numberGe == guessShi) {
            System.out.println("奖励500");
        }else {
            System.out.println("没中奖");
        }

        System.out.println("中奖号码是：" + number);






    }
}
